//
//  WXEmotionModel.swift
//  weibo
//
//  Created by 王旭 on 16/4/28.
//  Copyright © 2016年 王旭. All rights reserved.
//

import UIKit

class WXEmotionModel: NSObject,NSCoding {
    
    // 表情的描述字符串
    var chs: String?
    // emoji表情的code
    var code: String?
    // 如果为1，代表是Emoji表情,为0代表是图片表情
    var type: String?
    // 图片表情名字
    var png: String?
    // 表情属与的文件夹的名字
    var folderName: String?
    
    
    init(dic:[String:AnyObject]) {
        super.init()
        setValuesForKeysWithDictionary(dic)
    }
    
    override func setValue(value: AnyObject?, forUndefinedKey key: String) {
        
    }
    
    //归档
    func encodeWithCoder(encoder: NSCoder) {
        encoder.encodeObject(chs, forKey: "chs")
        encoder.encodeObject(code, forKey: "code")
        encoder.encodeObject(type, forKey: "type")
        encoder.encodeObject(png, forKey: "png")
        encoder.encodeObject(folderName, forKey: "folderName")
    }
    //解档
    required init?(coder decoder: NSCoder) {
        chs = decoder.decodeObjectForKey("chs") as? String
        code = decoder.decodeObjectForKey("code") as? String
        type = decoder.decodeObjectForKey("type") as? String
        png = decoder.decodeObjectForKey("png") as? String
        folderName = decoder.decodeObjectForKey("folderName") as? String
    }
    
    // 没有智能提示的
    override var description: String {
        let keys = ["chs", "code", "type"]
        return dictionaryWithValuesForKeys(keys).description
    }

}
